﻿using System.Web.Script.Serialization;

namespace Tools
{
    public class JsonHelper
    {
        public static string Serializer(object objValue)
        {
            string strResult = string.Empty;
            if (objValue != null)
            {
                JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                strResult = jsonSerializer.Serialize(objValue);
            }
            return strResult;
        }

        public static T Deserialize<T>(string jsonString)
        {
            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
            return jsonSerializer.Deserialize<T>(jsonString);
        }
    }
    
}
